package com.yhs.YShop.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import com.yhs.YShop.model.Operation;
public interface OperationMapper {

	/**
	 * 获取所有的权限
	 * @return
	 */
	@Select("select * from jshop_operation")
	List<Operation> findAll();
	/**
	 * 保存权限
	 * @param operation
	 * @return
	 */
	@Insert({"insert jshop_operation(parent_id,name,code,type,parent_menu_id,perm_type,sort) "
			+ "values(#{parentId},#{name},#{code},#{type},#{parentMenuId},#{sort})"})
	Integer saveOperation(Operation operation);
	/**
	 * 获取单个权限
	 * @param operationId 权限ID
	 * @return
	 */
//	@SelectProvider(type = Operation.class,method = "findOperationById")
	Operation findOperationById(@Param("id")Integer operationId);
	
}
